<style>
    .word{
        line-height: 25px;
        white-space: nowrap;
        display: inline-block;
        height: 25px;
        overflow: hidden;
        cursor: text;
        text-align: left;
        padding: 2px 4px;
        -moz-border-radius: 4px;
        -webkit-border-radius: 4px;
        border-radius: 4px;
        resize: none;
        color: #333333;
        background-color: #FFF;
        border: solid 1px #D7D7D7;
        outline: none;
    }
</style>
<include file="common:__head__"/>
<div class="permissions-tabs">
    <a class="role tabs-bg" href="{:U('Brand/index')}">品牌管理</a>
</div>
<div class="permissions-content">
    <div class="permissions-le">
        <!--<div class="permissions-content">-->
                <!--<div class="message-set">-->
                    <!--<span class="hints">操作提示</span>-->
                    <!--<span class="hints-dec">代理等级管理和添加,自由设置代理级别是否包邮！</span>-->
                <!--</div>-->
        <!--</div>-->
        <div class="add-msg">
            <a class="add-role" href="{:U('Agent/add_rank',array('id' =>$brand_id))}">新增级别+</a>
        </div>
        <div class="permissions-table">
            <table border="0" width="100%">
                <thead>
                <tr>
                    <td>ID</td>
                    <td width="40%">代理名称</td>
                    <td>是否包邮</td>
                    <td>操作</td>
                </tr>
                </thead>
                <tbody>
                <volist name="ranks" id="rank">
                    <tr>
                        <td style="text-align: center;">{$i}</td>
                        <td>
                            <input class="word" type="text" value="{$rank['rank_name']}" onchange="changeTableVal2('agentRank','rank_id','{$rank[rank_id]}','rank_name',this)" style="text-align: left; width:160px;"/>
                        </td>
                        <td>
                            <if condition='$rank[is_free] eq 1'>
                                <span class="yes" onClick="changeGoodsVal2('agent_rank','rank_id','{$rank.rank_id}','is_free',this)" ><i class="fa fa-check-circle"></i>是</span>
                                <else />
                                <span class="no" onClick="changeGoodsVal2('agent_rank','rank_id','{$rank.rank_id}','is_free',this)" ><i class="fa fa-ban"></i>否</span>
                            </if>
                        </td>
                        <td>
                            <a href="{:U('Agent/edit_rank',array('id' => $rank['rank_id']))}" class="btn btn-blue">编辑</a>
                            <if condition="$i neq 1">
                                <a href="javascript:;" data-id="{$rank['rank_id']}" class="del_rank btn btn-red">删除</a>
                            </if>
                        </td>
                    </tr>
                </volist>
                </tbody>
            </table>
        </div>
    </div>
    <div class="permissions-ri">
        <a href="" class="permissions-help">帮助和服务</a>
    </div>
</div>
<include file="common:__foot__"/>
<script>
    $(document).ready(function(){
            $(".del_rank").click(function(){
                var rid = $(this).attr("data-id");
                var _this = $(this);

                layer.confirm('您确认删除此层级吗？', {
                    btn: ['是的','点错了'] //按钮
                }, function(){
                    $.ajax({
                        url: "{:U('Agent/rank_del')}",
                        type: "post",
                        dataType : 'json',
                        data: {rank_id: rid},
                        success: function (msg)
                        {
                            if(msg.status == 'success'){
                                layer.msg('删除成功!', {icon: 1,time:1000});
                                window.location.reload();
                            }else{
                                layer.alert(msg.msg);
                            }
                        }
                    });
                });
            });
    });

</script>
</body>
</html>